Dynamic allocation of a buffer across multiple clients in a threaded processor

ABSTRACT

A method may include distributing ranges of addresses in a memory among a first set of functions in a first pipeline. The first set of the functions in the first pipeline may operate on data using the ranges of addresses. Different ranges of addresses in the memory may be redistributed among a second set of functions in a second pipeline without waiting for the first set of functions to be flushed of data.

CROSS-REFERENCE TO RELATED APPLICATION

This application is a divisional of U.S. patent application Ser. No.11/224,643, filed on Sep. 12, 2005, now U.S. Pat. No. 7,603,544 whichclaims the benefit of U.S. provisional application Ser. No. 60/638,427,filed Dec. 23, 2004, entitled “Dynamic Allocation Of A Buffer AcrossMultiple Clients In A Threaded Processor,” the entire content of whichis incorporated by reference herein.

BACKGROUND

Implementations of the claimed invention generally may relate toallocation of memory and, more particularly, to dynamic allocation ofmemory among processes.

In data processing, sometimes a memory is logically partitioned for useby a number of processes. If four processes are running, for example,the memory may be partitioned into four portions corresponding to eachof the processes. If the processes are related (e.g., as parts of apipeline process), such partitioning scheme may allocate each processsome minimum amount of the memory to prevent deadlock. The remainingamount of the memory above this aggregate minimum amount may beallocated among the processes to facilitate greater performance by theprocesses.

When the number of processes using a memory changes, it may be desirableto change the allocation of the memory to optimize for the new number ofprocesses (e.g., three or five, instead of the four processes in theabove example). Some or all of the existing processes, however, may haveassociated data in the memory, and such data may fall into anotherprocess's portion of the memory or may be orphaned if its process isdiscontinued. Thus, the memory is typically flushed (e.g., emptied ofdata) before it may be re-partitioned among the new number of processes.In some cases, the in-process data may be immediately deleted/flushedfrom the memory and reloaded as appropriate under the new partitioningscheme. In other cases, the in-process data may be implicitly flushedfrom the memory by allowing the processes to completely process itbefore repartitioning the memory.

Regardless of the scheme used for flushing, however, flushing the memorymay adversely affect performance of the processes. Flushing the memorybefore partitioning or allocation may delay the processing of data bythe old processes, the new processes, or both.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, which are incorporated in and constitute apart of this specification, illustrate one or more implementationsconsistent with the principles of the invention and, together with thedescription, explain such implementations. The drawings are notnecessarily to scale, the emphasis instead being placed uponillustrating the principles of the invention. In the drawings,

FIG. 1 illustrates an example system;

FIG. 2 illustrates a thread dispatcher in the example system of FIG. 1;

FIG. 3 illustrates a function block in the thread dispatcher of FIG. 2;

FIG. 4 is a flow chart illustrating a process of initially allocatingaddresses in a buffer among function blocks;

FIG. 5 is a flow chart illustrating a process of utilizing addresses ina buffer by function blocks;

FIG. 6 is a flow chart illustrating a process of dynamically changingaddress fences by function blocks; and

FIG. 7 illustrates exemplary message formats.

DETAILED DESCRIPTION

The following detailed description refers to the accompanying drawings.The same reference numbers may be used in different drawings to identifythe same or similar elements. In the following description, for purposesof explanation and not limitation, specific details are set forth suchas particular structures, architectures, interfaces, techniques, etc. inorder to provide a thorough understanding of the various aspects of theclaimed invention. However, it will be apparent to those skilled in theart having the benefit of the present disclosure that the variousaspects of the invention claimed may be practiced in other examples thatdepart from these specific details. In certain instances, descriptionsof well known devices, circuits, and methods are omitted so as not toobscure the description of the present invention with unnecessarydetail.

FIG. 1 illustrates an example system 100. System 100 may include amemory hierarchy 110, a thread dispatcher 120, a bus 130, and processingcores 140-1 to 140-n (collectively “processing cores 140”). System 100may include multiple processing cores 140 that support multi-threadedexecution. In some implementations, each of processing cores 140 maysupport one or multiple threads. Multi-threading on a single processor(e.g., core 140-1) may achieve efficient execution by allowing activethreads to be executed while other threads are in inactive state.

Memory hierarchy 110 may store data and instructions to be used duringexecution by one or more processing cores 140. Memory hierarchy 110 mayinclude dynamic random access memory (DRAM), one or more levels ofinstruction cache, one or more levels of data cache, and/or one or morelevels of shared instruction and data cache.

Thread dispatcher 120, which is coupled to memory hierarchy 110, mayreceive information, such as an instruction pointer and data and/or adata pointer, that is associated with a new thread. Thread dispatcher120 may be coupled with processing cores 140 via bus 130. Threaddispatcher 120 may manage the thread resources of processing cores 140.Upon receiving a new pending thread, thread dispatcher 120 may selectone processing core (e.g., core 140-3) that has resources available toexecute the pending thread and dispatches the thread to the selectedcore via bus 130. Upon the completion of an existing thread by aprocessing core, thread dispatcher 120 is informed and releases threadresource on that processing core for future threads.

FIG. 2 illustrates one possible implementation of thread dispatcher 120.Thread dispatcher 120 may include a command parser 210, a number offunction blocks 220-1, 220-2, . . . , 220-n (collectively “functionblocks 220”), a high priority bus interface (HPBI) 230, a low prioritybus interface (LPBI) 240, a unified return buffer (URB) 250, and adispatcher 260.

Command parser 210 may translate certain commands and requests into aformat that function blocks 220 may process. For example, command parser210 may break up a single command that concerns a number of functionblocks 220 into a number of commands and/or instructions that may berouted to individual function blocks 220.

Function blocks 220 may perform different functions, perhaps in apipelined manner. In some implementations, function blocks 220 mayimplement fixed graphical functions, such as one or more vertex shaders,a tessalator, a geometry shader, a clipper, a setup module, and awindower. Some of these fixed functions (e.g., some functional blocks220) may be active at any given time, and other functions (e.g., otherfunctional blocks 220) may be inactive. Each of the active functionblocks 220 may use some designated portion of (e.g., group of addressesin) unified return buffer 250 for its outputs.

FIG. 3 illustrates one possible implementation of function block 220.Function block 220 may include a set of address fences 310, a set ofscoreboards 320, an address/index computation unit 330, and a statemachine 340.

Address fences 310 may include a ping/pong set of address fences, eachfence having a Top register and Bottom register. The Top and Bottomregisters may store addresses that define a range of addresses in URB250 where function block 220 may store items. As used herein, “pong” maydenote an alternate set (e.g., a “new” set) in contrast to “ping” thatdenotes another set (e.g., an “old” or prior set). In the context ofaddress fences 310, an initial set of Top and Bottom fence values may bestored in the Ping fence registers, and when a replacement set of valuesarrives, it may be stored in the Pong fence registers. If anotherreplacement set of Top and Bottom values arrives, it may be stored inthe Ping fence registers, the Pong fence having the most recent values,and so forth.

Scoreboards 320 may include a ping scoreboard and a pong scoreboard,each scoreboard having one bit per address tracked in URB 250.Scoreboard may be large enough so that it may encompass the maximumforeseeable allocation of URB 250's entries for that function block 220.Hence, if a given function block 220 may only be allocated 20% of URB250, scoreboards 320 may be sized to 2 bits per entry (1 each for Pingand Pong) of that amount of URB 250.

Address/index computation unit 330 may include logic to compute anaddress from an index or vice versa. As used herein, an “index” maydenote a number (e.g., beginning at 0 and ending at the size of theaddress fence 310) denoting a relative position within the range ofaddresses defined by address fence 310. For an address within addressfence 310 of a function block 220, a corresponding index to that addressmay be computed as follows: Index=Address−Top, where Top denotes anupper end of the address fence 310. Similarly, unit 330 may compute anaddress from an index value as follows: Address=Top+Index. Instanceswhere address/index computation unit 330 is used will be describedbelow.

State machine 340 may perform a reallocation on scoreboards 320 upon achange between address fences 310. Such reallocation will be describedin greater detail below. State machine 340 may also perform otheraddress processing, such as determining whether to keep or pass along agiven address. State machine 340 may also perform other control and/orbookkeeping functions for function block 220.

Returning to FIG. 2, function blocks 220 may be interconnected by twobi-directional busses: HPBI 230 and LPBI 240. In each of HPBI 230 andLPBI 240, two point to point interfaces may span between each functionblock 220, one going “North”, the other going “South.” For example,addresses may be passes addressed down from an nth function block 220FB[n] to an (n+1)th function block 220 FB[n+1] over the Southboundinterface of HPBI 230 and/or LPBI 240. Similarly, FB[n+1] may passaddresses up to FB[n] over the Northbound interface of HPBI 230 and/orLPBI 240. Addresses issued to transfer ownership between function blocks220 may be passed on HPBI 230. Addresses issued to generate payloadsand/or addresses being returned to the producer function block 220 maybe passed on the LPBI.

HPBI 230 and LPBI 240 may be physically implemented in several ways. Insome implementations, two interfaces may be used in each direction inparallel. In some implementations, one interface in each direction maybe used with 2 virtual channels therein. If the virtual channelmechanism is implemented, virtual channel #1, for example, may be higherpriority (e.g., HPBI 230) than virtual channel #0, which may be used forLPBI 240. In some implementations, HPBI 230, LPBI 240, or both may beflow controlled.

URB 250 may be arranged to hold data associated with function blocks 220before and/or after processing by processing cores 140. As describedherein, URB 250 may be partitioned and shared by function blocks 220 byvirtue of the respective address fences 310 therein. In someimplementations, URB 250 may have 1024 entries or less, although theclaimed invention is not necessarily limited in this regard.

Dispatcher 260 may dispatch threads from function blocks 220 toprocessing cores 140 via bus 130. In some implementations, dispatcher260 may determine which one among the cores 140 to send a particularthread to. In some implementations, dispatcher 260 may route a thread toa particular processing core 250 that was specified by the originatingfunction block 220.

Returning to FIG. 1, bus 130 may include a number of communication linksamong memory hierarchy 110, thread dispatcher 120, and processing cores140. For ease of explanation, bus 130 is presented as a single line, butin practice bus 130 may include one or more control busses, data busses,etc. Bus 130 may carry data from thread dispatcher 120 for processing bycores 140, and it may also carry processed data from cores 140 to threaddispatcher 120 and/or memory hierarchy 110.

System 100 may also include multiple processing cores 140, each of whichinclude execution circuits with associated control circuitry. Processingcores 140 may be identical or may have varying functionality. Any numberof processor cores 140-1 to 140-n may be included in system 100. In someimplementations, processor cores 140 may be arranged in rows, each rowhaving an associated row controller.

FIG. 4 is a flow chart illustrating a process 400 of initiallyallocating addresses in buffer 250 among function blocks (FBs) 220. Uponstartup of system 100, or after a reset and/or flush, it may be assumedthat all scoreboards 320 in all FBs 220 are cleared, and that theTop/Bottom fence registers 310 are in a “don't care” state. The firstsequence of data read from a command stream in thread dispatcher 120 mayinclude a list of Top/Bottom fence values for each of the FBs 220.

Processing may begin by distributing these Top/Bottom fence values amongFBs 220 [act 410]. These Top/Bottom fence register values may besuccessively pipelined through FBs 220 over HPBI 230. In someimplementations, for example, the FB 220-1 may store the firstTop/Bottom pair in its address fence 310, and may pass the remainder ofthe fence values down to FB 201-2. FB 220-2 may store the top pair ofremaining values in its address fence 310, and may pass the remainder toFB 220-3 over HPBI 230, and so forth. The last function block 220-n mayconsume the last Top/Bottom pair.

Following in the command stream may be a list of addresses that arebeing allocated among FBs 220 [act 420]. The list of addresses may beinput into the first FB 220-1 over HPBI 230. FB 220-1 may looks at agiven addresses and determine if it is within its address range inaddress fence 310 [act 430].

If the address is not within the address fence 310 of FB 220-1, then itis passed to the next FB [act 440]. If the address is within FB 220-1'srange (or if passed, within the range of another FB such as 220-2), theFB may process the address [act 450].

In such address processing the FB may compute an associated index,Index=Address−Base, via computation unit 330. For this computed indexvalue, a bit may then be set in that FBs Ping scoreboard 320. Asindicated by the return arrows from acts 440 and 450, such addressprocessing may continue until all addresses have been associated withthe appropriate FB 220.

At the end of this sequence 400, all FBs 220 may have their Ping addressfences 310 valid, as well as their PING scoreboards 320 updated with theaddresses that they are allowed to use. In some implementations, theseindex addresses may start at zero and are incremental counts (0, 1, 2, .. . ) to the last address in the sequence, although the claimedinvention is not limited in this regard.

If a bit is set in the respective scoreboard 320, this denotes that thatparticular address is not “in flight” (e.g., in transit to anotherdestination). Thus, a zero (e.g., an un-set bit) in the scoreboard 320(within a particular address fence region) may denote that thatparticular address is in flight. An address that is not in flight may bereclaimed and re-used for a new output buffer destined for URB 250. Anaddress that is in flight, by contrast, may not be reclaimed for use aspart of a new output buffer.

Although process 400 may appear to be a less straightforward way to setscoreboard 320 at startup, such a scheme may make repartitioning ofaddress fences 310 similar to the scheme of the startup sequence.Optimizations are possible that do not issue addresses in front of FB220-1 to seed the pipeline with these addresses. The particular scheme400 above is described for ease of understanding, and its details do notnecessarily limit the claimed invention.

FIG. 5 is a flow chart illustrating a process 500 of utilizing addressesin buffer 250 by function blocks (FBs). After the initializationsequence 400, FB 220-1 may set its scoreboard read pointer at zero. FB220-1 may receive a task (e.g., a function or part of a function) fromthe command stream (e.g., command parser 210). Based on the bufferingrequirements (e.g., amount of space needed in URB 250) for this task, FB220-1 may allocate such space in URB 250 [act 510].

In act 510, for example, FB 220-1 may store the current scoreboard readpointer into a register (e.g., a Working Pointer (WP)) along with thedesired number of entries (e.g., a Working Count (WC)) in URB 250 forthe task. Although not explicitly shown in FIG. 3, the WP and WCregisters may be included in scoreboard 320 in some implementations. FB220-1 may check whether scoreboard 320 has “Working Count” contiguousones set, beginning at its scoreboard read pointer. If there are notthat many contiguous ones set in scoreboard 320, FB 220-1 may waitsuntil such a number become set. If such “working count” space isavailable, however, FR 220-1 may clear the bit at the current readpointer, and may advance the scoreboard read pointer by one. Suchclearing and advancing may be repeated until the number of entries inURB 250 needed for the task (e.g., the number in WC) are allocated,completing act 510. Other implementations of act 510 are possible, andthe above is presented primarily for ease of understanding.

The address(es) in URB 250 corresponding to the entries in scoreboard320 may be computed from the Working Pointer via the address computationunit 330 as follows: URB Address=WP+Top, where Top is obtained from theactive (e.g., Ping or Pong) address fence 310. If processing core(s) 140require more then one return address, the above calculation may berepeated for multiple return addresses. These return addresses in URB250 may be issued to processing core(s) 140 as the return addresses uponcompletion of computation for this portion of the task [act 520]. Othertask-related information may also be dispatched by FB 220-1 toprocessing core(s) 140 in conjunction with act 520.

All FBs 220, after dispatching work to processing core(s) 140, may besignaled back by URB 250 when their respective data has returned to URB250 after processing. Such signaling may occur automatically by URB 250when the data is written into URB 250. FB 220-1, for example, mayreceive such a notification via LPBI 240 [act 530].

After receiving a notice that its data is in buffer 250 in act 530, FB220-1 may generate a list of addresses for a downstream function block(e.g., FB 220-3) to use as its inputs [act 540]. In general, FB 220-nmay generate a list of addresses+counts associated with URB 250 for thenext FB 220-(n+x) to consume. The format of such an address list messagemay include the starting URB address and the word count. These addresses(and word counts) may be transmitted in FIFO (first in, first out)fashion to the neighboring, downstream function block (e.g., FB220-(n+1)) over LPBI 240. If FB 220-(n+1) is a null function (e.g., isnot being used for a given task), it may pass the information alonguntil it reaches the next function block 220 in the task, FB 220-(n+x).

After FB 220-(n+x) has consumed the data pointed to by the URB addressesfor the complete word count, the corresponding entry in scoreboard 320in the sending FE 220-n may be “freed.” Hence, FB 220-n may wait for thedata associated with the list of addresses that it sent to be consumedby the next FB 220-(n+x) [act 550]. The term “consumed,” as used herein,denotes that the addresses in question have been read from URB 250. Itshould be noted, however, that such address(es) may be considered to beconsumed, but still may be in flight to another destination FB 220. Forexample, if the address has been read by a FB 220 that is not itsultimate destination, it may be considered consumed while still being inflight to its destination.

After an address has been consumed by another FB 220, FB 220-n may putthe address back into the free list on its scoreboard 320 (e.g., it may“free” the address) [act 560]. Such “free” entry may be available forre-use in new return buffering operations in URB 250. To free anaddress, its index in scoreboard 320 may be calculated by computationunit 330 as follows: Index=URB Address−Active Top Fence. Such indexcalculation may be performed for all the “count” number of addressesassociated with this first address. This expansion of an address pluscount number may be referred to as “atomization.” For example, anaddress of 10 and a count of 4 may be atomized into addresses 10, 11,12, and 13. Next, the particular values of scoreboard 320 at the set ofindices (e.g., for address+count) may be set to indicate that theaddresses are free as follows: Scoreboard[Index]=1.

Upon receiving a “free” URB address and count (e.g., eitherself-generated or received via the Northbound or Southbound LPBI 240) FB220-n may compare the address to its present active Fence 310'sTop/Bottom pair and either keep the information or pass it North orSouth as appropriate over the LPBI 240 [act 570]. If the address(ignoring the word count) lies within that FB 220's Top/Bottom range, itis kept by that function block. If the address (ignoring word count) isless then that FB 220's Top value, it may be passed up through theNorthbound LPBI 240; and if it is greater then the FB 220's Bottomvalue, it may be passed down the Southbound LPBI 240. Making the compareand decision to pass the address up or down in act 570 after atomizationof the “free” URB+Count information in act 560 is intentional and allowsfor dynamic changes of fence 310 without needing to flush all of the FBs220. Such also allows fences 310 to move between previous contiguous URBallocations, as will be described further below.

Although described primarily with regard to FB 220-1, process 500 may beperformed in a similar manner by other function blocks, such as FB220-2, FB 220-3, etc.

In some implementations, a FB 220 may issue the same URB 250 entry (andword count) to a downstream FB 220 multiple times. For example, some FBs220 may use URB 250's entries as a cache, and a cache hit may entail agiven URB entry be read more then once by another FB. Thus, that URBentry may be outstanding multiple times. Scoreboard 320, which denoteswhether an address is in flight, should not treat such an entry as“free” until it has been consumed multiple times.

Hence, in some implementations, certain FBs 220 may maintain separatebookkeeping to track how many “freed” instances are needed before theaddress(es) can be repopulated into the scoreboard 330. Those functionblocks 220 that have this behavior may include a mechanism to count upevery time a given URB entry is issued, and a complementary mechanism tocount down every time a given URB entry is “freed.” Although notexplicitly illustrated, in some implementations, such counting mechanismmay be included in scoreboard 320 and/or state machine 340. Thiscounting mechanism need only keep track of the base URB address that itissues, and not all of the associated entries in URB 250 (e.g.,address+Count), if the count field remains the same.

Having described process 500 of utilizing addresses in a memory, dynamicreallocation of the memory among functions will now be discussed. Atsome point, it may be time for FBs 220 to “change state” (e.g., when oneor more FBs 220 is added to or deleted from a given functional chain orpipeline). For example, given a pipeline configuration of FBs 220 (i.e.,a vertex shader followed by a tessellator, followed by clipping, setupand a windower), there is presumably an ideal partitioning of URB 250across the function blocks 220 in this configuration. For a new pipelineconfiguration (e.g., a vertex shader followed by a geometry shader,followed by a clipper, setup and windower, or another configuration ofFBs 220 such as a vertex shader followed by the clipper, setup and thewindower), there may be a different ideal partition of URB 250 among FBs220. Such a change in state typically may involve a re-partitioning ofURB 250 among FBs 220 (e.g., a change of address fences within FBs 220).

One way to accomplish such re-partitioning may be to way wait until eachsuccessive FB 220 is flushed of data before changing address fences.Such a scheme, however, would result in an “implied flush” where thewhole pipeline would be delayed in changing state while successive FBs220 are flushed. Another way to re-partition would be to start passingaddresses from one FB 220 according to its new address fences, but sucha scheme may deadlock if there is only one “southbound” channel and ifsuch is flow controlled.

According to some implementations, to avoid deadlock while concurrentlychanging state and processing within the new state, the first FB 220does not wait for the downstream FBs 220 to flush. Nor does it waituntil scoreboard 320 of any stage is populated with all 1's (e.g., iscleared). Addresses from the old state may remain in transition duringthe state change, but the FBs 220 do not blindly keep passing addressesup and down. Instead, an address may flow up to complete its normal flowfrom the previous state while other addresses are also passed throughthe system to remap them into the new state. As will be describedfurther, HPBI 230 facilitates such dynamic state change (e.g.,re-partitioning of memory) without deadlock.

FIG. 6 is a flow chart illustrating a process 600 of dynamicallychanging address fences by a function block. Although described withregard to the first function block (e.g., FB 220-1) in a chain orpipeline, process 600 may be performed by successive FBs 220 to completedynamic reallocation of URB 250.

Processing may begin with FB 220-1 receiving a new set of address fencevalues [act 610]. These new values may be stored in either the ping orpong portion of address fence 310, depending on which currently housesthe fences for the present operating state. A new list of Top/Bottomfences for all FBs 220 may be issued by the command stream, and FB 220-1may take the first Top/Bottom set from the list and puts them in its(e.g., pong) address fence 310. FB 220-1 then may pass the remainder ofthe Top/Bottom fences to the next FB 220 (e.g., FB 220-2) via HPBI 230.

Processing may continue with FB 220-1 completing the processing/workthat it started before it received the new address fences [act 620].Such work may include data to process that has not yet returned to URB250, but may not include data in URB 250 that is associated with FB220-1 (e.g., in scoreboard 320). It is impermissible for FB 220-1 to“retire” an address into its new scoreboard (e.g., “pong” portion ofscoreboard 320) while it is still working on its old state. If FB 220-1is still working in its old state, any address that is not tagged asbeing passed for ownership should be fence compared against FB 220-1'spresent working fences and passed up, down, or kept based on the oldworking state.

After FB 220-1 finishes its present work it may scan its old scoreboard320 starting at zero for entries allocated in the old state. For eachsuch entry in the scoreboard it may perform the address translation toAddress=Scoreboard Index+Old Top. If the Address is within the newTop/Bottom fences it performs the translation Index=Address−New Top andsets the bit in the new scoreboard 320 at that index [act 630].

If the address is below the Bottom value or above the Top value of thenew address fence, FB 220-1 may pass the address downward or upward viaHPBI 230 with a “passing ownership” indicator [act 640]. Note that theTop value comparison is only relevant for FBs below the top FB 220-1.Addresses that have been compared with the new fence 310 and passed maybe tagged with a “passing ownership” indicator. Such an a passingownership indicator may indicate to other FBs 220 (e.g., FB 220-2) thatthis address should not be passed back to FB 220-1, but instead shouldbe compared with the receiving FB's new address fences (and set acorresponding entry in the receiving FB's new scoreboard if within thenew fences). For addresses that have been translated in act 630 orpassed in act 640, FB 220-1 may clears the corresponding entry in itsold scoreboard 320 (e.g., by setting it to zero). The dotted line inFIG. 6 indicates that acts 620 and 640 may be repeated for all entriesfound in old scoreboard 320.

If old scoreboard 320 has a zero at a given index (e.g., indicating noaddress), no operation may be performed in acts 630 and 640 on thatindex. The index may incremented, passing the zero. If the addresscalculation is performed and the entry maps into the new scoreboard 320,the FB 220 may write a zero to that new scoreboard entry instead of justpassing over it. Note that as soon as old scoreboard 320 is scanned FB220-1 may reset the scoreboard read pointer to zero for the newscoreboard and may start looking for contiguous 1's to generate a newpayload requiring entries in URB 250.

Concurrently with acts 630 and 640, addresses may be arriving at FB220-1 via the northbound LPBI 240. These arriving addresses may behandled by FB 220-1 with regard to the new fences 310 and scoreboard 320[act 650]. For example, if an incoming address maps within the newTop/Bottom fences 310, it may be referenced to the new scoreboard indexand the new scoreboard entry may be set to 1. If the address is outsideof new fence 310's range (in the case of first FB 220-1, it can only belarger then the Bottom value), the address may be sent back down to FB220-2 (or whichever is the next FB 220 in the pipeline) on HPBI 230 withthe “passing ownership” indicator.

When FB 220-1 is ready to send a first workload for the new state to thenext FB 220 (e.g., FB 220-2), it sends a “Flip State” message on thesouthbound LPBI 240 [act 660]. Such a flip state message instructs thenext FB in the pipeline to begin process 600. Although shown after act650, act 660 may, in some implementations, occur immediately after act620. When FB 220-2 sees this message and is done with the previousstate's work (e.g., after completing act 620) it may issue another “FlipState” message in order on its southbound LPBI 240.

To prevent mis-timed state changes, it is desirable a mechanism toprevent FB 220-1 from issuing data according to the new state before therest of the engine/pipeline is ready. Therefore, FB 220-1 may wait untilit receives some signal from the most downstream unit (e.g., FB 220-n,where n denotes the last unit in the pipeline), that indicates it hasgotten to its new state [act 670]. In some implementations, when themost downstream FB 220-n acts on the “Flip State” it received via itsLPBI 240, it may send an acknowledgment signal back to FB 220-1 via thenorthbound HPBI 230. All other FBs 220 in the pipeline may ignore thismessage. FB 220-1 may not, in such implementations, issue a new statepacket till the acknowledgment packet is received. Other acknowledgmentand/or delay mechanisms, however, are both possible and contemplated.

FB 220-1 may then begin to issue work in the new state [act 680].

Process 600 will now be described with regard to a downstream unit, suchas FB 220-2. FB 220-1 may have changed state while FB 220-2 may still bein the old state. Any address FB 220-2 “frees” that falls into its oldfences naturally fall into its old scoreboard. Any addresses that FB220-2 “frees” that fall outside of its old fences are passed upwardusing the northbound LPBI 240. This is also true of any addresses FB220-2 receives via its northbound LPBI 240 from a downstream unit (e.g.,FB 220-3). When FB 220-2 is done dispatching its work from the old stateit may perform acts 630 and 640, scanning its old scoreboard 320 andpassing addresses as necessary using the northbound or southbound HPBI230 with “passing ownership” semantics. Process 600 may be repeated bythe remaining units 220 to dynamically re-allocate URB 250 among them.

FIG. 7 illustrates exemplary message formats on HPBI 230 and LPBI 240.Message 710 illustrates a format of a message that is southbound (e.g.,to a successive FB 220) on HPBI 230. Message 720 illustrates a format ofa message that is northbound (e.g., to a prior FB 220) on HPBI 230.Similarly, messages 730 and 740 illustrate formats of messages that arerespectively southbound and northbound on LPBI 240.

It may be noted that all of the URB addresses in messages 710-740 areillustrated as 10 bit fields. This data length assumes that URB 250 willhave 1024 entries or less, and may differ based on the size of thememory addressed. This may be adjusted if desired should URB 250 orother memory to be re-partitioned need more or less address space.

As described herein address fence mechanisms 310 may be incorporated ineach of function blocks 220. Each function block 220 may use, for itsoutputs into URB 250, any of the addresses within its own fence range.These addresses are passed to downstream functions 220 for subsequentreads and for further processing. After the subsequent read is performedthe address is either kept by that function block 220 (e.g., when theaddress is within that function block's address range), passed down(e.g., when the address is greater then that function block's addressrange), or passed up (e.g., when the address is less then that functionblock's address range). When a state change in function blocks 220occurs, address fences 310 may be dynamically reconfigured withoutdeadlocks or needing to completely flush function blocks 220 ofassociated data.

The foregoing description of one or more implementations providesillustration and description, but is not intended to be exhaustive or tolimit the scope of the invention to the precise form disclosed.Modifications and variations are possible in light of the aboveteachings or may be acquired from practice of various implementations ofthe invention.

For example, although the memory reallocation scheme herein has beendescribed with regard to return buffer 250 and function blocks 220, itis applicable to dynamic reallocation in memories by/for computationalfunctions and/or threads generally. Also, other schemes are bothpossible and contemplated for the address sorting and bookkeepingfunctions performed by address fences 310 and scoreboards 320 that weredescribed herein. Further, although address fences 310 assume contiguousaddresses for a function block 220, discontiguous addresses in buffermay also be associated with a given function block 220 with differentassociation logic than fences, if desired.

Moreover, the acts in FIGS. 4-6 need not be implemented in the ordershown; nor do all of the acts necessarily need to be performed. Also,those acts that are not dependent on other acts may be performed inparallel with the other acts. Further, at least some of the acts in thisfigure may be implemented as instructions, or groups of instructions,implemented in a machine-readable medium.

No element, act, or instruction used in the description of the presentapplication should be construed as critical or essential to theinvention unless explicitly described as such. Also, as used herein, thearticle “a” is intended to include one or more items. Variations andmodifications may be made to the above-described implementation(s) ofthe claimed invention without departing substantially from the spiritand principles of the invention. All such modifications and variationsare intended to be included herein within the scope of this disclosureand protected by the following claims.

1. A system, comprising: a memory; and a plurality of configurablefunction blocks that are allocated portions of the memory, each of thefunction blocks including: a first unit to store values that define arange in the memory currently used by the function block, wherein thefirst unit includes storage for at least one range in the memory inaddition to the currently used range, and a second unit to track usageof the currently used range, wherein the second unit includes storage totrack usage of the at least one range in the memory in addition to thecurrently used range.
 2. The system of claim 1, wherein each of thefunction blocks further includes: a computational unit to translatebetween an address value in the memory and an index in the second unitbased on a value in the first unit.
 3. The system of claim 2, whereineach of the function blocks further includes: logic to set or clearvalues in the second unit based on indices from the computational unit.4. The system of claim 1, further comprising: one or more processors toreceive data from the function blocks or the memory, to process thedata, and to write processed data in the memory.
 5. The system of claim1, further comprising: a high priority bidirectional bus connecting theplurality of configurable function blocks; and a low prioritybidirectional bus connecting the plurality of configurable functionblocks.